package function;

import org.apache.flink.table.annotation.DataTypeHint;
import org.apache.flink.table.annotation.FunctionHint;
import org.apache.flink.table.functions.TableFunction;
import org.apache.flink.types.Row;
import util.IKanalyzerUtil;

import java.io.IOException;
import java.util.Collection;

@FunctionHint(output = @DataTypeHint("Row<split_word string>"))
public class KeywordUDTF extends TableFunction<Row> {

    public void eval(String kw) throws IOException {
        Collection<String> kws = IKanalyzerUtil.analyzer(kw);
        for (String s : kws) {
            collect(Row.of(s));
        }
    }
}
